package ocl;


public class IterateExpression extends OclExpression {

	OclExpression collection, condition;
	VariableDeclaration var1, var2;

	public IterateExpression(OclExpression oclExpression,
			VariableDeclaration variableDeclaration,
			VariableDeclaration variableDeclaration2,
			OclExpression oclExpression2) {

		this.collection = oclExpression;
		var1 = variableDeclaration;
		var2 = variableDeclaration2;
		condition = oclExpression2;

	}

	public IterateExpression(OclExpression oclExpression,
			VariableDeclaration variableDeclaration,
			OclExpression oclExpression2) {
		this(oclExpression, null, variableDeclaration, oclExpression2);
	}

	@Override
	public String toK() {
		if (var1 == null)
			return collection.toK() + "->iterate(" + var2.toK() + "|" + condition.toK() + ")";
		else
			return collection.toK() + "->iterate(" + var1.toK() + ";" + var2.toK() + "|"
					+ condition.toK() + ")";
	}
}
